package ink.tiptop.common.worker.hotdata;

import ink.tiptop.utils.async.callback.ICallback;
import ink.tiptop.utils.async.callback.IWorker;
import ink.tiptop.utils.async.worker.WorkResult;
import ink.tiptop.utils.async.wrapper.WorkerWrapper;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;
import java.util.Observable;

/**
 * @author ink.tiptop.zjf
 * @Title: Ticket
 * @Package ink.tiptop.common.worker.heat
 * @Description:
 * @date 2020-07-31 14:54
 */
@Slf4j
public class HotDataWorker implements IWorker<Observable, Boolean>, ICallback<Observable, Boolean> {

    @Override
    public void begin() {
        log.info("开始异步预热数据...");
    }

    @Override
    public void result(boolean success, Observable param, WorkResult<Boolean> workResult) {
        log.info("结束异步预热数据...");
    }

    @Override
    public Boolean action(Observable service, Map<String, WorkerWrapper> allWrappers) {
        service.notifyObservers();
        return true;
    }

    @Override
    public Boolean defaultValue() {
        return null;
    }
}
